﻿using Fabrication.Tests.TestClasses;
using NUnit.Framework;

namespace Fabrication.Tests
{
    [TestFixture]
    public class generics
    {
        [Test]
        public void should_create_properties_which_are_closed_generic_types()
        {
            var builtItem = new FabricationScope().Generate<ClassWithClosedGenericProperty>();

            Assert.That(builtItem.GenericProperty, Is.Not.Null);
        }

        [Test]
        public void should_populate_properties_which_are_closed_generic_types()
        {
            var builtItem = new FabricationScope().Generate<ClassWithClosedGenericProperty>();

            Assert.That(builtItem.GenericProperty.Value, Is.EqualTo("Value1"));
        }

        [Test]
        public void should_create_properties_which_are_open_generic_types_of_a_closed_generic()
        {
            var builtItem = new FabricationScope().Generate<ClassWithOpenGenericProperty<int>>();

            Assert.That(builtItem.GenericProperty, Is.Not.Null);
        }

        [Test]
        public void should_populate_properties_which_are_open_generic_types_of_a_closed_generic()
        {
            var builtItem = new FabricationScope().Generate<ClassWithOpenGenericProperty<int>>();

            Assert.That(builtItem.GenericProperty.Value, Is.EqualTo(1));
        }
    }
}
